package com.ssy.lingxi.purchase.api.enums.bidding;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 采购询价单作废原因状态枚举
 * @author lxc
 * @date 2022/3/17
 */
public enum CancelReasonStateEnum {

    NO_ONE_SIGNED_UP(1, "报名截止时间内, 无人报名"),
    REGISTRATION_PROCESS_NOT_APPROVED(2, "报名截止时间内, 有报名流程采购商未审核"),
    PROCESS_NOT_APPROVED(3, "报名截止时间内, 所有报名都未审核通过"),
    NO_QUOTATION_AS_OF(4, "竞价截止时间内, 无人竞价"),
    ;

    private Integer state;
    private String name;

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public String getName() {
        return LanguageHolder.getName(this.getClass(), this.state);
    }

    public void setName(String name) {
        this.name = name;
    }

    CancelReasonStateEnum(Integer state, String name) {
        this.state = state;
        this.name = name;
    }

    public static String getName(Integer state){
        CancelReasonStateEnum workEnum = Arrays.stream(CancelReasonStateEnum.values()).filter(v -> v.getState().equals(state)).findAny().orElse(null);
        return null == workEnum ? "" : LanguageHolder.getName(CancelReasonStateEnum.class, workEnum.getState());
    }
}
